home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / lang / Python16_Src.lha / Python16_Source / Parser / parser.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-03  |  919 b   |  39 lines

  1. #ifndef Py_PARSER_H
  2. #define Py_PARSER_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6.  
  7. /* Parser interface */
  8.  
  9. #define MAXSTACK 500
  10.  
  11. typedef struct {
  12.     int         s_state;    /* State in current DFA */
  13.     dfa        *s_dfa;        /* Current DFA */
  14.     struct _node    *s_parent;    /* Where to add next node */
  15. } stackentry;
  16.  
  17. typedef struct {
  18.     stackentry    *s_top;        /* Top entry */
  19.     stackentry     s_base[MAXSTACK];/* Array of stack entries */
  20.                     /* NB The stack grows down */
  21. } stack;
  22.  
  23. typedef struct {
  24.     stack         p_stack;    /* Stack of parser states */
  25.     grammar        *p_grammar;    /* Grammar to use */
  26.     node        *p_tree;    /* Top of parse tree */
  27. } parser_state;
  28.  
  29. parser_state *PyParser_New Py_PROTO((grammar *g, int start));
  30. void PyParser_Delete Py_PROTO((parser_state *ps));
  31. int PyParser_AddToken
  32.     Py_PROTO((parser_state *ps, int type, char *str, int lineno));
  33. void PyGrammar_AddAccelerators Py_PROTO((grammar *g));
  34.  
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif /* !Py_PARSER_H */
  39.